import { RouteRecordRaw } from 'vue-router';
import setting from './setting';

export default<readonly RouteRecordRaw[]> [
  {
    path: '/',
    component: () => import('@/layout/index.vue'),
    children: [
      {
        path: '/',
        meta: {
          cacheKey: 'home',
          tabName: '首页',
          tabFixed: true
        },
        component: () => import('@/views/Home.vue'),
      },
      {
        path: '/list/Project',
        meta: {
          cacheKey: '/list/Project',
          tabName: '项目列表',
        },
        props: {
          typeId: 1
        },
        component: () => import('@/views/List.vue'),
      },
      {
        path: '/list/Requirement',
        meta: {
          cacheKey: '/list/Requirement',
          tabName: '需求列表',
        },
        props: {
          typeId: 2
        },
        component: () => import('@/views/List.vue'),
      },
      {
        path: '/view/:id',
        meta: {
          cacheKey: route => `/view/${route.params.id}`,
          tabName: route => `详情: ${route.params.id}`,
        },
        component: () => import('@/views/View.vue'),
      },
      setting
    ]
  },
  {
    path: '/404',
    component: () => import('@/views/404.vue'),
  },
  {
    path: '/:pathMatch(.*)',
    redirect: '/404'
  }
]
